﻿using System;
using System.Dynamic;
using System.IO;

namespace Framework
{
    public class RecurseFileEvent<T>
    {
        public RecurseFileEvent(T data)
        {
            Data = data;
        }

        public bool IsDirectory { get; protected set; }

        public FileInfo File { get; protected set; }

        public DirectoryInfo Directory { get; protected set; }

        public void SetPath(DirectoryInfo directory)
        {
            IsDirectory = true;
            Directory = directory;
        }

        public void SetPath(FileInfo file)
        {
            IsDirectory = false;
            File = file;
            Directory = file.Directory;
        }

        public Action<RecurseFileEvent<T>>  Action { get; set; }  

        public T Data { get; set; }
    }
    public class RecurseFileEvent : RecurseFileEvent<dynamic>
    {
        public RecurseFileEvent()
            : base(new ExpandoObject())
        {
        }
    }
}
